/**
 * 基础增删查改api类
 */

import request from '@/utils/request'

class service {
  constructor(path) {
    this.path = path
  }
  add(params) {
    return request({
      url: `${this.path}/add`,
      method: 'post',
      data: params
    })
  }
  update(params) {
    return request({
      url: `${this.path}/update`,
      method: 'post',
      data: params
    })
  }
  delete(id) {
    return request({
      url: `${this.path}/delete`,
      method: 'get',
      params: id
    })
  }
  batchdelete(arr) {
    return request({
      url: `${this.path}/batchdelete`,
      method: 'post',
      data: arr
    })
  }
  list(params) {
    return request({
      url: `${this.path}/list`,
      method: 'get',
      params
    })
  }
  query(id) {
    return request({
      url: `${this.path}/query`,
      method: 'get',
      params: id
    })
  }
  dashboardQuery(id) {
    return request({
      url: `${this.path}`,
      method: 'get'
    })
  }
  thumbnailDelete(params) {
    return request({
      url: `${this.path}/thumbnail/delete`,
      method: 'post',
      data: params
    })
  }
}
export default service
